package Hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import Entities.Entity_Area;
import Entities.Entity_Barra;
import Entities.Entity_Cafeteria;
import Entities.Entity_Caja;
import Entities.Entity_Carta;
import Entities.Entity_Cocina;
import Entities.Entity_Comision;
import Entities.Entity_CompraInsumo;
import Entities.Entity_CompraVenta;
import Entities.Entity_Deposito;
import Entities.Entity_DepositoArea;
import Entities.Entity_DepositoCentral;
import Entities.Entity_DepositoLocal;
import Entities.Entity_ElaboracionNoVenta;
import Entities.Entity_ElaboracionVenta;
import Entities.Entity_Empleado;
import Entities.Entity_Encargado;
import Entities.Entity_Factura;
import Entities.Entity_InformeReposicion;
import Entities.Entity_InformeReposicionArea;
import Entities.Entity_Ingrediente;
import Entities.Entity_Insumo;
import Entities.Entity_InsumoAReponer;
import Entities.Entity_ItemCarta;
import Entities.Entity_ItemFactura;
import Entities.Entity_Local;
import Entities.Entity_Mesa;
import Entities.Entity_Movimiento;
import Entities.Entity_Mozo;
import Entities.Entity_OrdenDeCompra;
import Entities.Entity_PedidoInsumo;
import Entities.Entity_PlanProdSemiElab;
import Entities.Entity_Producto;
import Entities.Entity_ProductoVenta;
import Entities.Entity_Proveedor;
import Entities.Entity_Receta;
import Entities.Entity_RecetaCombo;
import Entities.Entity_RecetaSimple;
import Entities.Entity_Reserva;
import Entities.Entity_Salon;
import Entities.Entity_Sector;
import Entities.Entity_StockInsumo;
import Entities.Entity_StockProducto;
import Entities.Entity_Tarea;
public class HibernateUtil {
	private static final SessionFactory sessionFactory;
	static {
		try {
			AnnotationConfiguration config = new AnnotationConfiguration();
			config.addAnnotatedClass(Entity_Mesa.class);
			config.addAnnotatedClass(Entity_Empleado.class);
			config.addAnnotatedClass(Entity_Encargado.class);
			config.addAnnotatedClass(Entity_Mozo.class);
			config.addAnnotatedClass(Entity_Producto.class);
			config.addAnnotatedClass(Entity_ProductoVenta.class);
			config.addAnnotatedClass(Entity_CompraVenta.class);
			config.addAnnotatedClass(Entity_ElaboracionNoVenta.class);
			config.addAnnotatedClass(Entity_ElaboracionVenta.class);

			config.addAnnotatedClass(Entity_Area.class);
			config.addAnnotatedClass(Entity_Barra.class);
			config.addAnnotatedClass(Entity_Cafeteria.class);
			config.addAnnotatedClass(Entity_Cocina.class);
			config.addAnnotatedClass(Entity_Caja.class);
			config.addAnnotatedClass(Entity_Carta.class);
			config.addAnnotatedClass(Entity_Comision.class);
			config.addAnnotatedClass(Entity_Deposito.class);
			config.addAnnotatedClass(Entity_DepositoArea.class);
			config.addAnnotatedClass(Entity_Factura.class);

			config.addAnnotatedClass(Entity_Insumo.class);
			config.addAnnotatedClass(Entity_ItemCarta.class);
			config.addAnnotatedClass(Entity_ItemFactura.class);
			config.addAnnotatedClass(Entity_PedidoInsumo.class);
			config.addAnnotatedClass(Entity_Proveedor.class);
			config.addAnnotatedClass(Entity_Receta.class);
			config.addAnnotatedClass(Entity_RecetaCombo.class);
			config.addAnnotatedClass(Entity_RecetaSimple.class);
			config.addAnnotatedClass(Entity_Reserva.class);
			config.addAnnotatedClass(Entity_Salon.class);
			config.addAnnotatedClass(Entity_Sector.class);
			config.addAnnotatedClass(Entity_StockInsumo.class);
			config.addAnnotatedClass(Entity_StockProducto.class);
			config.addAnnotatedClass(Entity_Tarea.class);
			config.addAnnotatedClass(Entity_Movimiento.class);

			config.addAnnotatedClass(Entity_Local.class);
			config.addAnnotatedClass(Entity_PlanProdSemiElab.class);
			config.addAnnotatedClass(Entity_InformeReposicion.class);
			config.addAnnotatedClass(Entity_InformeReposicionArea.class);
			config.addAnnotatedClass(Entity_Ingrediente.class);
			config.addAnnotatedClass(Entity_InsumoAReponer.class);
			config.addAnnotatedClass(Entity_Deposito.class);
			config.addAnnotatedClass(Entity_DepositoArea.class);
			config.addAnnotatedClass(Entity_DepositoLocal.class);
			config.addAnnotatedClass(Entity_DepositoCentral.class);
			
			config.addAnnotatedClass(Entity_OrdenDeCompra.class);
			config.addAnnotatedClass(Entity_CompraInsumo.class);

			sessionFactory = config.buildSessionFactory();
		} catch (Throwable ex) {
			System.err.println("Initial SessionFactory creation failed." + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}

}
